
import os
import shutil
import sys
import time
import math
import json
import zipfile
from subprocess import run
import subprocess
# import thread
# import thread6
sys.path.append('..')
import FileUtils
import ArrayUtils

curPath = os.getcwd()
print(curPath)

projectPath = os.path.abspath(os.path.join(os.path.dirname(curPath), os.pardir,os.pardir))
print(projectPath)


pacList = []

def packPng():
	print("todo")

def deleteUnuseFile():
	print("todo")
	
def copyPacFileToLocal():
	for path in pacList:
		print("path = ",os.path.dirname(path))
		#先复制到一个叫test1里面先
		FileUtils.copyDirOneByOne(os.path.dirname(path),os.path.join(curPath,"test"))
	pass


def autoSearchAutoAtlas():

	def callback(filepath,filename):
		print("filename = ",filename)
		pacList.append(filepath)
		pass

	FileUtils.diguiDirWithTail("D:\\projectXH\\creator2d\\BanZhuanH5\\client\\assets\\res\\BattleScene\\FinalReport",callback,".pac")
	pass


def autoSearch():
	print("autoSearch")
	#查找自动图集的地方
	autoSearchAutoAtlas()
	#复制所有的散图到当前目录下某个地方
	copyPacFileToLocal()
	#删除所有无用的文件
	deleteUnuseFile()
	#使用tp打包成图集
	packPng()
	#复制新图集到到目标目录
	#生成meta文件
	#配置plist uuid
	pass

if __name__ == "__main__":
	print("hello")

	autoSearch()
	

	pass



